package com.nervenets.template.hibernate.domain.user;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.nervenets.general.hibernate.DomainObject;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import javax.persistence.*;

@ApiModel("用户附加属性表")
@Entity
@Table(
        indexes = {
                @Index(name = "index_of_field", columnList = "user_id,field")
        }
)
@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@SuperBuilder
public class UserExtra extends DomainObject {
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_id")
    @JsonIgnore
    protected User user;
    @ApiModelProperty(value = "附加名称")
    private String field;
    @ApiModelProperty(value = "附加值")
    private String value;
}
